package com.dwxt.cdms.scheduling;

import com.dwxt.cdms.service.AiAoLeDataService;
import com.dwxt.cdms.service.WatchService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 推送数据相关的定时任务
 *
 * @author Kuang.JiaZhuo
 * @date 2020-09-22 14:15
 */
@Component
@EnableScheduling
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PushDataSchedule {

    private final WatchService watchService;

    private final AiAoLeDataService aiAoLeDataService;

    /**
     * @方法名：deleteWasteData
     * @描述： 清理废数据(零点过1分执行)
     * @作者： kjz
     * @日期： Created in 2020/9/22 14:18
     */
    @Scheduled(cron = "0 1 0 * * ?")
    public void deleteWasteData(){
        //删除腕表废数据
        watchService.deleteWasteDataByWeek();

        //删除爱奥乐废数据
        aiAoLeDataService.deleteWasteDataByWeek();
    }
}
